package com.module.umlib.umeng;

import com.umeng.socialize.bean.SHARE_MEDIA;

import java.util.Map;

/**
 * @Author: dengqi
 * @CreateDate: 2020/4/29 10:09
 * @Description:
 */
public class Umeng {

    public SHARE_MEDIA platform;
    public int action;
    public Map<String, String> data;

    public Umeng(SHARE_MEDIA platform) {
        this.platform = platform;
    }

    public Umeng(SHARE_MEDIA platform, int action, Map<String, String> data) {
        this.platform = platform;
        this.action = action;
        this.data = data;
    }

    public String getAccessTokenBySina() {
        if (platform == SHARE_MEDIA.SINA) {
            return data.get("access_token");
        }
        return "";
    }

    public String getPlatformName() {
        String result = "";
        if (platform == SHARE_MEDIA.SINA) {
            result = "新浪";
        } else if (platform == SHARE_MEDIA.QQ) {
            result = "QQ";
        } else if (platform == SHARE_MEDIA.QZONE) {
            result = "QQ空间";
        } else if (platform == SHARE_MEDIA.WEIXIN) {
            result = "微信";
        } else if (platform == SHARE_MEDIA.WEIXIN_CIRCLE) {
            result = "微信朋友圈";
        }
        return result;
    }
}
